<#include 'layout/template.ftl'/>
<@htmlHead title=''>

</@htmlHead>


<@htmlBody 'vote'  'cooperative'   >

	<#include 'layout/breadcrumbs.ftl'>
	<@breadcrumbs '管理'   '新增'></@breadcrumbs>
	
	<!-- page-content begin -->
	<div class="page-content">
			
		<!-- page-header begin -->
		<div class="page-header">
				<h1>
					新增
				</h1>
		</div>
		<!-- page-header end -->

		<!-- page-body begin -->
		<div class="row">	
			<div class="col-md-6 col-md-offset-3">
				
				<!-- 表单开始 -->
				<form class="form-horizontal" id="validation-form" method="post" action="${path}/manage/vote/cooperative/create" >
						<div class="form-group">
							<label class="control-label col-md-2">id:</label>
					
							<div class="col-md-10">
								<div class="clearfix">
									<input type="text" class="form-control"  name="id"  id="id" value="${ cooperative.id  }" />
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-2">name:</label>
					
							<div class="col-md-10">
								<div class="clearfix">
									<input type="text" class="form-control"  name="name"  id="name" value="${ cooperative.name  }" />
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-2">picurl:</label>
					
							<div class="col-md-10">
								<div class="clearfix">
									<input type="text" class="form-control"  name="picurl"  id="picurl" value="${ cooperative.picurl  }" />
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-2">createTime:</label>
					
							<div class="col-md-10">
								<div class="clearfix">
									<input type="text" class="form-control"  name="createTime"  id="createTime" value="${ cooperative.createTime  }" />
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-2">status:</label>
					
							<div class="col-md-10">
								<div class="clearfix">
									<input type="text" class="form-control"  name="status"  id="status" value="${ cooperative.status  }" />
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-2">areaId:</label>
					
							<div class="col-md-10">
								<div class="clearfix">
									<input type="text" class="form-control"  name="areaId"  id="areaId" value="${ cooperative.areaId  }" />
								</div>
							</div>
						</div>
						
						<div class="col-md-8 center">
                    		<button type="submit" class="btn btn-primary">
								<i class="fa fa-save align-top bigger-125"></i>保存
							</button>
					 
							<button type="reset" class="btn">
								<i class="fa fa-pencil align-top bigger-125"></i>重置
							</button>
						</div>	
					
				</form>
				<!-- 表单结束 -->
			</div>
		</div>
		<!-- page-body end -->
		
	</div>		
	<!-- page-content end -->
	
</@htmlBody>

<@htmlBodyScript>

	<!-- 验证框架 -->	
	<script src="${resources}/plugins/jquery-validation/jquery.validate.min.js"></script>
	<script src="${resources}}/plugins/jquery-validation/messages_zh.min.js"></script>
	<script type="text/javascript">

			jQuery.validator.addMethod("isName", function(value, element) {       
	 			var corpName =  /^[\u0391-\uFFE5\w\-\s\.]{1,50}$/;
  				 return this.optional(element) || corpName.test(value);       
 			}, "请使用汉字、英文字母、数字、下划线、减号、空格或点");   
 			
	
			$('#validation-form').validate({
				errorElement: 'div',
				errorClass: 'help-block',
				focusInvalid: false,
				rules: {
					id: {
						required:true
					},
					name: {
						required:true
					},
					picurl: {
						required:true
					},
					createTime: {
						required:true
					},
					status: {
						required:true
					},
					areaId: {
						required:true
					}
				},
		
				messages: {
				},
		
		
				highlight: function (e) {
					$(e).closest('.form-group').removeClass('has-info').addClass('has-error');
				},
		
				success: function (e) {
					$(e).closest('.form-group').removeClass('has-error');//.addClass('has-info');
					$(e).remove();
				},
		
				errorPlacement: function (error, element) {
					if(element.is('input[type=checkbox]') || element.is('input[type=radio]')) {
						var controls = element.closest('div[class*="col-"]');
						if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
						else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
					}
					else if(element.is('.select2')) {
						error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));
					}
					else if(element.is('.chosen-select')) {
						error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));
					}
					else error.insertAfter(element.parent());
				},
		
				submitHandler: function (form) {
					
					form.submit();
				},
				invalidHandler: function (form) {
				}
			});
	</script>
	
</@htmlBodyScript>	


